package com.blog.common.newclass.dostringabs;


import com.blog.common.newclass.inteface.DoStr;

/**
 * 加密：隐藏前4个符
 */
public class DoEntryFirst extends DoEntryAbs {

    private static final String REPLASE_STR = "**";
    private static final int FIRST_NUM = 3;

    public DoEntryFirst(DoStr doStr) {
        super(doStr);
    }

    @Override
    public String getStr() throws Exception {
        String source = super.getStr();
        if (source.length() <= FIRST_NUM)
            return REPLASE_STR;
        source = source.substring(FIRST_NUM);
        return REPLASE_STR.concat(source);
    }

    @Override
    public int cost() {
        return super.cost()+1;
    }

}